package xq.gwt.ui.widgets.entity;

import com.smartgwt.client.widgets.Window;

public class PopupFormEntityPresenter extends FormEntityPresenter {
	final Window winModal = new Window();
	private int windowHeight = 700;
	private int windowWidth = 1000;
	
	public void show() {		
		winModal.setWidth(getWindowWidth());
		winModal.setHeight(getWindowHeight());
		winModal.setTitle(getTitle());
		winModal.setShowMinimizeButton(false);
		winModal.setIsModal(true);
		winModal.setShowModalMask(true);
		winModal.centerInPage();
		winModal.setShowFooter(true);		
		winModal.addItem(this.getCanvas());
		winModal.show();
	}
	
	public void close(){		
		winModal.destroy();
	}
	
	public int getWindowHeight(){
		return windowHeight;
	}
		
	public void setWindowHeight(int windowHeight) {
		this.windowHeight = windowHeight;
	}
	
	public int getWindowWidth(){
		return windowWidth;
	}

	public void setWindowWidth(int windowWidth) {
		this.windowWidth = windowWidth;
	}
	
	protected String getTitle(){
		if(entity == null){
			return "";
		}
		return entity.getTitle();
	}
		
}
